﻿<phone:PhoneApplicationPage
    x:Class="JukeboxParty.VotingPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="True">

    <Grid x:Name="LayoutRoot" Background="Transparent">
        <!--Pivot Control-->
        <phone:Pivot Title="JUKEBOX PARTY">
            <!--Next Track Pivot Item-->
            <phone:PivotItem Header="next track">
                <ScrollViewer>
                    <ItemsControl Name="NextTrackItemsControl">
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel/>
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Grid Margin="0,0,0,5">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <Image Name="AlbumArt" Grid.Column="0" Margin="0,0,15,0"
                                           Source="{Binding SongAlbum.AlbumArtPath}"
                                           Height="{Binding ElementName=SongInfoPanel, Path=ActualHeight}"
                                           MaxWidth="{Binding ElementName=SongInfoPanel, Path=ActualHeight}"/>
                                    <StackPanel x:Name="SongInfoPanel" Grid.Column="1">
                                        <TextBlock Name="ArtistName" Text="{Binding SongArtist.Name}" FontSize="30" FontWeight="Bold"/>
                                        <TextBlock Name="AlbumName" Text="{Binding SongAlbum.Name}" FontSize="24"/>
                                        <TextBlock Name="SongName" Text="{Binding Name}" FontSize="20"/>
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="*"/>
                                                <ColumnDefinition Width="*"/>
                                            </Grid.ColumnDefinitions>

                                            <Button Name="VoteUpButton" Content="Vote Up" Grid.Column="0" FontSize="16"/>
                                            <Button Name="VoteDownButton" Content="Vote Down" Grid.Column="1" FontSize="16"/>
                                        </Grid>
                                    </StackPanel>
                                </Grid>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </ScrollViewer>
            </phone:PivotItem>

            <!--Current Song Pivot Item-->
            <phone:PivotItem Header="current song">
                <Grid Name="CurrentSongGrid">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>

                    <Image Grid.Row="0" Source="{Binding CurrentSong.SongAlbum.AlbumArtPath}"/>
                    <TextBlock Grid.Row="1" Text="{Binding CurrentSong.SongArtist.Name}" FontSize="55" Margin="10,0,0,0"/>
                    <TextBlock Grid.Row="2" Text="{Binding CurrentSong.SongAlbum.Name}" FontSize="40" Margin="25,0,0,0"/>
                    <TextBlock Grid.Row="3" Text="{Binding CurrentSong.Name}" FontSize="30" Margin="25,0,0,0"/>
                    <Button Name="DownloadCurrentButton" Content="Download" Grid.Row="4" Padding="30,0" Margin="0,0,0,10" HorizontalAlignment="Center"/>
                </Grid>
            </phone:PivotItem>

            <!--Request Track Pivot Item-->
            <phone:PivotItem Header="request track">
                <ScrollViewer>
                    <ItemsControl Name="RequestTrackItemsControl">
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel/>
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Margin="0,0,0,10">
                                    <TextBlock Text="{Binding Name}" FontSize="58" Margin="0,0,0,7"/>
                                    <ItemsControl ItemsSource="{Binding Albums}">
                                        <ItemsControl.ItemsPanel>
                                            <ItemsPanelTemplate>
                                                <StackPanel/>
                                            </ItemsPanelTemplate>
                                        </ItemsControl.ItemsPanel>
                                        <ItemsControl.ItemTemplate>
                                            <DataTemplate>
                                                <StackPanel Margin="0,0,0,15">
                                                    <Image Source="{Binding AlbumArtPath}" Height="150" Margin="0,0,10,0" HorizontalAlignment="Left"/>
                                                    <TextBlock x:Name="AlbumNameText" Text="{Binding Name}" FontSize="48" VerticalAlignment="Center" Margin="0,0,0,5"/>
                                                    <ItemsControl ItemsSource="{Binding Songs}">
                                                        <ItemsControl.ItemsPanel>
                                                            <ItemsPanelTemplate>
                                                                <StackPanel/>
                                                            </ItemsPanelTemplate>
                                                        </ItemsControl.ItemsPanel>
                                                        <ItemsControl.ItemTemplate>
                                                            <DataTemplate>
                                                                <Grid>
                                                                    <Grid.ColumnDefinitions>
                                                                        <ColumnDefinition Width="50"/>
                                                                        <ColumnDefinition Width="*"/>
                                                                    </Grid.ColumnDefinitions>
                                                                    <TextBlock Text="{Binding TrackNumber}" Opacity="0.7" FontSize="32" Margin="2,0,15,2" Grid.Column="0"/>
                                                                    <TextBlock Text="{Binding Name}" FontSize="32" Margin="0,0,0,2" Grid.Column="1"/>
                                                                </Grid>
                                                            </DataTemplate>
                                                        </ItemsControl.ItemTemplate>
                                                    </ItemsControl>
                                                </StackPanel>
                                            </DataTemplate>
                                        </ItemsControl.ItemTemplate>
                                    </ItemsControl>
                                </StackPanel>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </ScrollViewer>
            </phone:PivotItem>
        </phone:Pivot>
    </Grid>

</phone:PhoneApplicationPage>